<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <input id="int" type="text" onkeyup="re(value)"> 
</body>
<script>
   
    function  re(val) {
    var re  =/^[\u4e00-\u9fa5]{1,10}$|^[\dA-Za-z_]{1,20}$/;
      if(re.test(val)){
          console.log('阳哥真棒')
      }else{
          console.log('超出范围')
      }
    }


</script>
</html>